home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / c / pdc / libsrc / stringlib / strdup.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-04-07  |  720 b   |  30 lines

  1. /*
  2.  * Libraries and headers for PDC release 3.3 (C) 1989 Lionel D. Hummel.
  3.  * PDC Software Distribution (C) 1989 Lionel Hummel and Paul Petersen.
  4.  * PDC I/O Library (C) 1987 by J.A. Lydiatt.
  5.  *
  6.  * This code is freely redistributable upon the conditions that this notice
  7.  * remains intact and that modified versions of this file not be included
  8.  * as part of the PDC Software Distribution without the express consent of
  9.  * the copyright holders.
  10.  */
  11.  
  12. /*
  13.  *    strdup.c 
  14.  *
  15.  *    strdup() returns a duplicate string that can be safely modified
  16.  */
  17.  
  18. char *strdup(string)
  19. char *string;
  20. {
  21.     char *retval;
  22.  
  23.     retval = malloc(strlen(string)+1);
  24.  
  25.     if (retval != 0L)
  26.         strcpy(retval, string);
  27.  
  28.     return(retval);
  29. }
  30.